package com.ftg.midamall.admin.service;


import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ftg.midamall.admin.dto.AdminInfo;
import com.ftg.midamall.admin.dto.ModifyAdminInfo;
import com.ftg.midamall.admin.dto.UserInfo;
import com.ftg.midamall.admin.entity.UmsAdmin;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ftg.midamall.admin.entity.UmsAdminRoleRelation;
import com.ftg.midamall.admin.vo.UmsAdminVo;
import com.ftg.midamall.comm.vo.RespMessUtil;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 后台用户表 服务类
 * </p>
 *
 * @author qjw
 * @since 2023-10-20
 */
public interface IUmsAdminService extends IService<UmsAdmin> {

    String upload(MultipartFile icon, Long id);

    RespMessUtil<UmsAdminVo> login(UserInfo userInfo);


    Integer deleteAdmin(int id);

    Integer modifyAdminPass(int id, String password);

    RespMessUtil<IPage> showAdminWithPage(@Param("username") String username, @Param("status") Integer status, @Param("start") int start, @Param("limit") int limit);

    Integer modifyAdmin(@RequestBody ModifyAdminInfo u);


    Integer saveRole(UmsAdminRoleRelation umsAdminRoleRelation);

    Integer deleteAllAdmin(List<Integer> id);

    Boolean switchStatus(int id);

    RespMessUtil<Boolean> modifyUser(UmsAdmin id);

    RespMessUtil<JSONObject> uploadAvatar(Long id, MultipartFile avatarFile);

    RespMessUtil<Integer> register(@Param("u") AdminInfo u, List<Long> adminIds);

    /**
     * 修改
     * @param u
     * @param roleIds
     * @return
     */
    RespMessUtil<Integer> updateById(AdminInfo u, List<Long> roleIds);


}
